# Maintainer: Andreas Radke <andyrtr@archlinux.org>

pkgname=libetpan
pkgver=1.9.1
pkgrel=1
pkgdesc="A portable middleware for email access"
arch=('x86_64')
url="http://www.etpan.org/libetpan.html"
license=("custom:etpan")
depends=('libgcrypt' 'gnutls' 'libsasl' 'zlib')
makedepends=('expat')
source=($pkgname-$pkgver.tar.gz::https://github.com/dinhviethoa/${pkgname}/archive/${pkgver}.tar.gz)
sha256sums=('f5e354ccf1014c6ee313ade1009b8a82f28043d2504655e388bb4c1328700fcd')

prepare() {
  cd ${pkgname}-${pkgver}
  libtoolize --force --copy
  aclocal -I m4
  autoheader
  autoconf
  automake --add-missing --foreign --force --copy
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr \
    --disable-static \
    --disable-db \
    --with-openssl=no \
    --with-gnutls=yes
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make check
  cd tests
  make imap-sample
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
  install -Dm644 COPYRIGHT ${pkgdir}/usr/share/licenses/$pkgname/license.txt
}
